#!/bin/bash
###
 # @Author: chyang0822 270917365@qq.com
 # @Date: 2024-08-22 10:53:03
 # @LastEditors: chyang0822 270917365@qq.com
 # @LastEditTime: 2024-11-05 18:11:36
 # @FilePath: /Project-DMAI-Deploy/tutorials/tensorrt/1.6-onnx-parser-source-code/onnx/make_pb.sh
 # @Description: 
 # 
 # Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
### 

# 请修改protoc为你要使用的版本protoc
export LD_LIBRARY_PATH=/datav/software/anaconda3/lib/python3.9/site-packages/trtpy/trt8cuda112cudnn8/lib64
protoc=protoc

cd onnx

echo Create directory "pbout"
rm -rf pbout
mkdir -p pbout

$protoc onnx-ml.proto --cpp_out=pbout
$protoc onnx-operators-ml.proto --cpp_out=pbout

echo Copy pbout/onnx-ml.pb.cc to ../src/onnx/onnx-ml.pb.cpp
cp pbout/onnx-ml.pb.cc           ../src/onnx/onnx-ml.pb.cpp

echo Copy pbout/onnx-operators-ml.pb.cc to ../src/onnx/onnx-operators-ml.pb.cpp
cp pbout/onnx-operators-ml.pb.cc ../src/onnx/onnx-operators-ml.pb.cpp

echo Copy pbout/onnx-ml.pb.h to ../src/onnx/onnx-ml.pb.h
cp pbout/onnx-ml.pb.h           ../src/onnx/onnx-ml.pb.h

echo Copy pbout/onnx-operators-ml.pb.h to ../src/onnx/onnx-operators-ml.pb.h
cp pbout/onnx-operators-ml.pb.h ../src/onnx/onnx-operators-ml.pb.h

echo Remove directory "pbout"
rm -rf pbout